import cmath
import numpy as np

# 复数的数学运算
# 网络认证方案可能会用到复数空间
def demo_1():
    a = complex(2,4)
    b = 3 - 5j
    print(a)
    print(b)
    print(a.real)
    print(a.imag)
    print(a.conjugate())
    print(a + b)
    print(a - b)
    print(a * b)
    print(a / b)
    print(abs(b))
    print(cmath.sin(b))
    print(cmath.cos(b))
    print(cmath.exp(b))

# numpy可以处理复数
def demo_2():
    a = np.array([2+3j, 4+5j, 6-7j, 8+9j])
    print(a + 2)
    print(np.sin(a))


if __name__ == '__main__':
    # demo_1()
    demo_2()